
window.onload=function(){
//定时器每秒调用一次fnDate()
    setInterval(function(){
        showDate();
    },1000);
    function showDate() {
        var today = new Date();
        date = today.getDate();
        if(date<10) date = '0' + date;
        month = today.getMonth();
        month = month + 1;
        if(month<10) month = '0' + month;
        hours= today.getHours()< 10 ? "0" + today.getHours(): today.getHours();//小时
        minute= today.getMinutes()< 10 ? "0" + today.getMinutes() : today.getMinutes();//分
        second= today.getSeconds() < 10 ? "0" + today.getSeconds() : today.getSeconds();//秒
        year = today.getYear();
        if (year < 1900) {
            year = year + 1900;
        }
        var s = '';
        if(hours<11){
            s = '上午';
        }else if(hours>=11 && hours<13){
            s = '中午';
        }else{
            s = '下午';
        }

        var nowDate = year + '年' + month + '月' + date;
//Firefox下的兼容处理
        var nowDate = year + '年' + month + '月' + date;
        var time =( '今天是 : '+year + "年" + month + "月" + date + "日");
        var time_min = ( hours+ ":" + minute+ ":" + second)
        var myddy=today.getDay();//获取存储当前日期
        var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
        $('.tit_time').html(time)
        $('.tit_week').html(weekday[myddy])
        $('.tit_times').html(s)
        $('.time_min').html(time_min)

    }
}

